# coding:utf-8

import redis
import pymysql

class Config(object):
    """配置信息"""

    SECRET_KEY = "XHSD***NJGDGF"

    # 数据库
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:zhu123.@127.0.0.1:3306/test"
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # redis
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    #flask-session
    SESSION_TYPE = "redis"
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True   # 对cookie中的session_id 进行隐蔽处理
    PREMANET_SESSION_LIFETIME = 86400 # session数据的有效期， 单位秒


class DevelopmentConfig(Config):
    """开发者模式的配置信息"""
    DEBUG = True


class ProductionConfig(Config):
    """生成环境的配置信息"""
    pass

config_map = {
    "product": ProductionConfig,
    "develop": DevelopmentConfig
}
